import { history } from "@umijs/max";
import { useEffect } from "react";
import styles from "./index.less";
import { backgroundColor, color } from "../../../config/defaultSettings";

type styleType = {
  height: string;
  backgroundColor?: string;
  color?: string;
};

export default () => {
  const { pathname } = history.location;
  const style: styleType = { height: "calc(100vh - 56px)" };
  if (pathname === "/welcome") {
    style.height = "100vh";
    style.backgroundColor = backgroundColor;
    style.color = color;
  }

  useEffect(() => {
    const now = new Date();
    const date = now.toLocaleDateString().replaceAll("/", "-");
    const time = now.toTimeString().substring(0, 8);
    console.log(pathname, "现在是：", date, time);
  }, []);

  return (
    <div className={styles.container} style={style}>
      <label>欢迎使用</label>
    </div>
  );
};
